<%@ page language="java" import="java.util.*" import="java.text.SimpleDateFormat" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>在线点餐系统管理平台</title>
<link rel="stylesheet" href="${pageContext.request.contextPath }/admin/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath }/admin/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath }/admin/css/invalid.css" type="text/css" media="screen" />
<script type="text/javascript" src="${pageContext.request.contextPath }/admin/scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/admin/scripts/simpla.jquery.configuration.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/admin/scripts/facebox.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/admin/scripts/jquery.wysiwyg.js"></script>

<script type="text/javascript">

function chkfoodType(foodType){
	if($.trim(foodType)==""){
		$("#foodTypeSpan").html(" 请填写商品类型！");
		return;
	}
	 var url="foodTypeManager_!ckFoodType";
	 $.post(url,{"name":foodType},function(data){
		  if(data=="true"){
		  	    $("#foodTypeSpan").html("<font color='red'>该类型已经存在 ！</font>");
		  	 	$("#tijiao").attr("disabled",'true');
		   }
		   else{
		    $("#foodTypeSpan").html("");
		      $("#tijiao").removeAttr("disabled");
		   }
		});
}
function submitFood(foodType)
{
	 var url="foodTypeManager_!addFoodType";
	  $.post(url,{"name":foodType},function(data){
		  if(data=="true"){
		  	    $("#foodTypeSpan").html("<font color='green'>添加 成功！</font>");
		  	 	$("#tijiao").attr("disabled",'true');
		   }
		   else{
		    $("#foodTypeSpan").html("添加失败！");
		     $("#tijiao").attr("disabled",'true');
		   }
		});
}

</script>
</head>
<body>
  <%-- 加载左边菜单 --%>
  <s:include value="../main/left.jsp?mid=m23"></s:include>
	<div class="clear"></div>
  <div id="main-content">
    <!-- Box Content -->
    <div class="content-box">
    	<!-- Box Header -->
      <div class="content-box-header">
        <h3>添加商品类型</h3>
        <div class="clear"></div>
      </div>
      <!-- End Box Header -->     
  
      <div class="tab-content">
        <s:form namespace="/admin">
        	<fieldset>
          <p>
          	<label>商品类型</label>
            <s:textfield cssClass="text-input small-input" id="foodType" name="foodType" onmouseout="chkfoodType(this.value)"  onmouseover="chkfoodType(this.value)"/>
            <span id="foodTypeSpan"></span>
            <br />
          	<small>必填</small>
          <p><input class="button" type="button"  disabled id="tijiao" value="提  交" onclick="submitFood($('#foodType').val())"/></p>
          </fieldset>
        </s:form>
      </div>
      <!-- End Table Content -->
     </div>
     
     <!-- End Box Content -->
  
	<div class="clear"></div>
	<%-- 加载底部 --%>
	<s:include value="../main/footer.jsp"></s:include>
	</div>
</body>
</html>

